#coding: utf-8

class Instruction:
    
    __label = "";
    __instrct = None;
    __instrctType = "fn";
    __pipeStage = -1; #0-"BI", 1-"LR", 2-"OU", 3-"AD", 4-"ER"
    __execCicle = 1;
    
    def __init__(self, label, instrc, tp = "fn"):
        self.__label = label;
        self.__instrct = instrc;
        self.__pipeStage = -1;
        self.__execCicle = 1;
        self.__instrctType = tp;
        
    def advPipeStage(self):
        self.__pipeStage = self.__pipeStage+1;
    
    def getLabel(self):
        sl = "";
        if (self.__label < 10):
            sl = "0"+str(self.__label);
        else:
            sl = str(self.__label);
        return "I"+sl;
    
    def getCicle(self):
        return self.__execCicle;
    
    def getStage(self):
        return self.__pipeStage;
    
    def advCicle(self):
        self.__execCicle = self.__execCicle + 1;
        
    def resetCicle(self):
        self.__execCicle = 1;
    
    def getType(self):
        return self.__instrctType;
    
    def getOperandos(self):
        return self.__instrct.getOperandos();
    
    def getInstruction(self):
        s = ""
        for register in self.getOperandos():
            s = s + " " + register.getRegister();
        return self.__instrct.getOp() + s;